package com.dwxt.cdms.controller;

import com.dwxt.cdms.base.Page;
import com.dwxt.cdms.entity.Setmeal;
import com.dwxt.cdms.service.SetmealService;
import com.dwxt.common.base.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/cdms/setmeal")
@RestController
public class SetmealController {

    @Autowired
    private SetmealService setmealService;

    /**
     * 分页查询
     */
    @RequestMapping("/page")
    public BaseResult page() {
        return BaseResult.ok(setmealService.page());
    }

    /**
     * list查询
     */
    @RequestMapping("/list")
    public BaseResult list() {
        return setmealService.list();
    }

    /**
     * 新增
     */
    @RequestMapping("/add")
    public BaseResult add(Setmeal setmeal) {
        return setmealService.add(setmeal);
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public BaseResult delete(Integer id){
        return setmealService.delete(id);
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public BaseResult update(Setmeal setmeal){
        return  setmealService.update(setmeal);
    }

    /**
     * 分页查询用户的套餐列表
     */
    @RequestMapping("/selectPageByCustomerId")
    public BaseResult selectPageByCustomerId(Page page,Integer customerId) {
        return setmealService.selectPageByCustomerId(page,customerId);
    }
}

